/*
 * dll_manager.hpp
 *
 *  Created on: Nov 2, 2012
 *      Author: khanhhh
 */

#ifndef DLL_MANAGER_HPP_
#define DLL_MANAGER_HPP_

#include "../lua_interaction/luna.hpp"
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/time.h>
#include <boost/shared_ptr.hpp>
#include <iostream>
#include <map>
#include <list>
#include <vector>
#include <string>
#include <dlfcn.h>
#include <unistd.h>
#include "shape.hpp"
namespace http {
namespace server3 {
using namespace std;
class dll_manager {
public:
	static const char className[];
	static Luna<dll_manager>::RegType methods[];

	dll_manager(lua_State *L);
	int get_function(lua_State *L);
	~dll_manager();
private:
	FILE *dl; // handle to read directory
	list<void*> dl_list; // list to hold handles for dynamic libs
	list<void *>::iterator itr;
	vector < string > shape_names; // vector of shape types used to build menu
	list<shape *> shape_list;      // list of shape objects we create
	list<shape *>::iterator sitr;
	map<string, maker_t*>::iterator fitr;
};
}
}
#endif /* DLL_MANAGER_HPP_ */
